#include "HandshakeThreadPool.h"

#include "thread.h"

#include <cstdlib>
#include <memory>
#include <utility>

namespace droneswarm
{

    HandshakeThreadPool::HandshakeThreadPool( int num )
        : started_( false )
        , numThreads_( num )
    {
        if ( numThreads_ <= 0 )
        {
            std::cerr << "The number of thread pools processing handshakes is less than 0, and thread pool initialization fails."
                      << std::endl;
            abort();
        }
    }

    HandshakeThreadPool::~HandshakeThreadPool() {}

    void HandshakeThreadPool::start()
    {
        started_ = true;
        for ( int i = 0; i < numThreads_; ++i )
        {
            std::unique_ptr< Thread > t = std::make_unique< Thread >();
            threadsPool_.emplace_back( std::move( t ) );
        }
    }
}  // namespace droneswarm